﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using TaskScheduler;
using System.Configuration;
namespace MedicareNoteManagerWeb
{
    /// <summary>
    /// WSAddPlan 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消对下行的注释。
    // [System.Web.Script.Services.ScriptService]
    public class WSAddPlan : System.Web.Services.WebService
    {
        
        string filePath = ConfigurationManager.AppSettings["FilePath"].ToString();
        [WebMethod]
        public void CreateTestTask(DateTime RunTime,string TaskName)
        {
            Task t;
            ScheduledTasks st = new ScheduledTasks();
            t = st.CreateTask(TaskName);
            t.ApplicationName = filePath;
            t.SetAccountInformation("", (string)null);
            t.IdleWaitMinutes = 10;
            t.Triggers.Add(new RunOnceTrigger(RunTime));
            t.Save();
            t.Close();
        }
    }
}
